import request from "@/utils/request";

export const Login = (data: object) => {
    return request({
        url: "/login",
        method: "post",
        data,
    });
};
// 获取管理员信息和权限菜单
export const getInfo = () => {
    return request({
        url: "/getinfo",
        method: "post",
        data: {},
    });
};

// 修改密码
export const updatepassword = (data: object) => {
    return request({
        url: "/updatepassword",
        method: "post",
        data,
    });
};

// 用户列表
export const getUserList = (page: number, keyword: string) => {
    return request({
        url: `/user/${page}?limit=10&keyword=${keyword}`,
        method: "get",
    });
};

// 修改状态
export const changStatus = (id: number, data: object) => {
    return request({
        url: `/user/${id}/update_status`,
        method: "POST",
        data,
    });
};

// 添加内容

export const addUser = (data: object) => {
    return request({
        url: `/user`,
        method: "POST",
        data,
    });
};
// 修改内容
export const editUser = (id: number, data: object) => {
    return request({
        url: `/user/${id}`,
        method: "POST",
        data,
    });
};
// 删除
export const delUser = (id: number) => {
    return request({
        url: `/user/${id}/delete `,
        method: "POST",
    });
};

